package com.coai.file.dto

import com.coai.file.model.FileCategory
import com.coai.file.model.FileStatus
import java.time.LocalDateTime

/**
 * 文件上传响应
 */
data class FileUploadResponse(
    val id: String,
    val originalName: String,
    val url: String,
    val thumbnailUrl: String?,
    val mimeType: String,
    val size: Long,
    val category: FileCategory,
    val md5Hash: String?,
    val createdAt: LocalDateTime
)

/**
 * 文件信息DTO
 */
data class FileInfoDto(
    val id: String,
    val originalName: String,
    val storedName: String,
    val mimeType: String,
    val size: Long,
    val extension: String?,
    val url: String,
    val thumbnailUrl: String?,
    val uploaderId: String,
    val uploaderName: String?,
    val conversationId: String?,
    val messageId: String?,
    val status: FileStatus,
    val category: FileCategory,
    val downloadCount: Long,
    val expiresAt: LocalDateTime?,
    val metadata: Map<String, Any>?,
    val createdAt: LocalDateTime
)

/**
 * 文件列表响应
 */
data class FileListResponse(
    val files: List<FileInfoDto>,
    val hasMore: Boolean,
    val total: Long
)

/**
 * 分片上传初始化请求
 */
data class InitChunkUploadRequest(
    val fileName: String,
    val fileSize: Long,
    val chunkSize: Long,
    val md5Hash: String?
)

/**
 * 分片上传初始化响应
 */
data class InitChunkUploadResponse(
    val uploadId: String,
    val chunkSize: Long,
    val totalChunks: Int,
    val existingFile: FileUploadResponse? = null // 如果文件已存在（秒传）
)

/**
 * 分片上传状态
 */
data class ChunkUploadStatusResponse(
    val uploadId: String,
    val fileName: String,
    val totalChunks: Int,
    val uploadedChunks: List<Int>,
    val progress: Double,
    val status: String
)

/**
 * 存储使用统计
 */
data class StorageUsageDto(
    val totalSize: Long,
    val fileCount: Long,
    val byCategory: Map<FileCategory, CategoryUsage>,
    val quota: Long,
    val usagePercentage: Double
)

data class CategoryUsage(
    val count: Long,
    val size: Long
)
